package com.baizan.daka.ui.adapter


import android.graphics.Color
import android.widget.TextView
import com.baizan.daka.mvp.model.bean.PakeageInfoBean
import com.baizan.daka.util.HyperTextUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.dianzan.daka.R

class MyPackageAdapter : BaseQuickAdapter<PakeageInfoBean, BaseViewHolder>(R.layout.item_package) {


    override fun convert(helper: BaseViewHolder, item: PakeageInfoBean) {
        helper.setText(R.id.vip_name_tv, item.packageName)
            .setText(
                R.id.like_sum_tv, HyperTextUtil.build("获赞数：")
                    .appendColor("${item.likeNumber}", Color.parseColor("#1B78FD"))
                    .Builder()
            )
            .setText(
                R.id.reward_price_tv, HyperTextUtil.build("悬赏金额：")
                    .appendColor("${item.unitPrice}", Color.parseColor("#1B78FD"))
                    .Builder()
            )
            .setText(
                R.id.vip_prcie_tv, HyperTextUtil.build(item.packagePrice)
                    .appendSize("元", 12).Builder()
            )
            .setText(R.id.task_sum_tv, "${item.packageDesc + item.packageDesc}")
        helper.getView<TextView>(R.id.submit_bt).setCompoundDrawablesWithIntrinsicBounds(
            null, null, null, null
        )
        when(item.usedFlag){
            0 -> {
                helper.setTextColor(R.id.submit_bt,Color.parseColor("#0D77FE"))
                    .setText(R.id.submit_bt,"未使用")
            }
            1 -> {
                helper.setTextColor(R.id.submit_bt,Color.parseColor("#FF9211"))
                    .setText(R.id.submit_bt,"已使用")
            }
        }

    }


}